package net.zisen.cloud.wallet.fallback;

import feign.hystrix.FallbackFactory;
import net.zisen.cloud.base.msg.ResultMsg;
import net.zisen.cloud.wallet.client.WalletClient;

import java.math.BigDecimal;

/**
 * @author tim/278002989@qq.com
 * @Classname WalletClientFallback
 * @Description TODO
 * @Date 2019-05-17 18:26
 */
public class WalletClientFallback implements FallbackFactory<WalletClient> {
    @Override
    public WalletClient create(Throwable throwable) {
        return new WalletClient() {


            /**
             * 扣除钱包金额
             *
             * @param uid
             * @param amount
             * @param num
             * @param description
             * @return
             */
            @Override
            public ResultMsg deduct(Long uid, BigDecimal amount, String num, String description) {
                return null;
            }

            /**
             * 查询钱包余额
             *
             * @param uid
             * @return
             */
            @Override
            public ResultMsg<BigDecimal> checkWalletBalance(Long uid) {
                return ResultMsg.fail().resultMsg("获取金额失败");
            }
        };
    }
}
